package com.andyage.admin.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.andyage.admin.bean.RoleStaffBean;
import com.andyage.admin.dao.RoleStaffMapper;
import com.andyage.admin.service.IRoleStaffService;

import net.sf.json.JSONObject;
@Service
public class RoleStaffServiceImpl implements IRoleStaffService {
	@Resource
	private RoleStaffMapper roleStaffMapper;
	@Override
	public String insertRoletoStaff(RoleStaffBean roleStaffBean) {
		int flag=roleStaffMapper.insertRoletoStaff(roleStaffBean);
		JSONObject json = new JSONObject();
		if (flag!=0) {
			json.accumulate("result", 1);
			json.accumulate("tips", "修改成功");
		} else {
			json.accumulate("result", 0);
			json.accumulate("tips", "修改失败");
		}
		return json.toString();
	}

	@Override
	public String queryRoleStaff(RoleStaffBean roleStaffBean) {
		RoleStaffBean roleStaff=roleStaffMapper.queryRoleStaff(roleStaffBean);
		return null;
	}

	@Override
	public String updateRoleStaff(RoleStaffBean roleStaffBean) {
		int flag=roleStaffMapper.updateRoleStaff(roleStaffBean);
		JSONObject json = new JSONObject();
		if (flag!=0) {
			json.accumulate("result", 1);
			json.accumulate("tips", "修改成功");
		} else {
			json.accumulate("result", 0);
			json.accumulate("tips", "修改失败");
		}
		return json.toString();
	}

}
